package com.lumlord.controller;


import com.lumlord.exception.BusinessException;
import com.lumlord.service.LogDataService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

@RestController
@RequestMapping("/log")
public class LogController {

    @PostMapping("/send/system/aop")
    public void sendAop(@RequestBody Map log, @Value("${lumlord.mqtt.topic}")String topic) throws BusinessException {
        logDataService.log(log,topic,true);
    }

    @PostMapping("/send/system/full")
    public void send(@RequestBody Map log, @Value("${lumlord.mqtt.topic}")String topic) throws BusinessException {
        logDataService.log(log,topic,false);
    }




    @Autowired
    private LogDataService logDataService;
}
